<?php require('/parts/header.php')?>

<?php if ($currentUser) : ?>
	
	<?php require('controllers/indexController.php')?>
	
	<table border='1'>
		<th>Id</th><th>Имя</th><th>Возраст</th><th>Логин</th><th>Пароль</th><th></th><th></th>
	<?php foreach ($aStudents as $student) : ?>
		<tr>
			<form method="GET">
				
				<td>
					<input type="text" readonly="readonly" name="studentId"
						value="<?php echo $student->id?>"
						style="width: 50px"
					/>
				</td>
				<td>
					<input type="text" name="studentName"
						value="<?php echo $student->name?>"
					/>
				</td>
					
				<td>
					<input type="text" name="studentAge"
						value="<?php echo $student->age?>"
					/>
				</td>
				<td>
					<input type="text" name="studentLogin"
						value="<?php echo $student->login?>"
					/>
				</td>
					
				<td>
					<input type="text" readonly name="studentPassword"
						value="<?php echo $student->password?>"
					/>
				</td>
				<td><input name="delete" type="submit" value="X"/></td>	
				<td><input name="edit" type="submit" value="EDIT"/></td>	
			</form>
		</tr>		
		
	<?php endforeach;?>
	</table>	
	
	<form method="GET">
		<fieldset>
			<legend>Создать новую запись</legend>
			<table>
			<tr>
				<td><label for="studentName">Имя</label></td>
				<td><input type="text" id="studentName" name="studentName"/></td>
			</tr>
			<tr>	
				<td><label for="studentAge">Возраст</label></td>
				<td><input type="text" name="studentAge"></td>
			</tr>
			<tr>
				<td><label for="studentLogin">Логин</label></td>
				<td><input type="text" id="studentLogin" name="studentLogin"/></td>
			</tr>
			<tr>	
				<td><label for="studentPassword">Пароль</label></td>
				<td><input type="text" name="studentPassword"></td>
			</tr>
			</table>
			<input name='add' type="submit" value="ОК">
		</fieldset>
	</form>

<?php endif;?>
<?php require('/parts/footer.php')?>	
